package com.cskaoyan.controller.wxcontroller;

import com.cskaoyan.bean.pojo.User;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.wxbo.WxFeedbackBo;
import com.cskaoyan.service.WxFeedbackService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wx/feedback")
public class WxFeedbackController {

    @Autowired
    WxFeedbackService wxFeedbackService;

    @PostMapping("submit")
    public BaseRespVo wxFeedback(@RequestBody WxFeedbackBo wxFeedbackBo) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipals ().getPrimaryPrincipal ();
        int i = wxFeedbackService.feedbackSubmit (wxFeedbackBo, user);
        return BaseRespVo.ok (i);
    }
}
